Imports System.IO
Imports System.Collections.Specialized
Imports System.Collections.Generic
Imports System.Text

Public Class DictValStrings
  Inherits Dictionary(Of Integer, String)

  Sub New(ByVal filepath As String)
    Dim lines As String()
    Dim v As Integer, desc As String
    lines = File.ReadAllLines(filepath)

    For i As Integer = 0 To lines.Length - 1
      v = Val(lines(i))
      If v > 0 AndAlso Not Me.ContainsKey(v) Then
        Dim pos As Integer = lines(i).Trim().IndexOf(" "c)
        desc = ReplaceNonAlphaChars(lines(i).Substring(pos + 1).Trim())
        Me.Add(v, desc)
      End If
    Next

  End Sub

  Public Shared Function ReplaceNonAlphaChars(ByVal s As String) As String
    Dim sb As New StringBuilder

    For Each c As Char In s.ToCharArray()
      If Char.IsLetterOrDigit(c) OrElse c = "." OrElse c = "#" _
       OrElse c = "-" OrElse c = "+" Then : sb.Append(c)
      Else : sb.Append(" "c)
      End If
    Next
    Return sb.ToString()
  End Function

End Class
